﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace inf_1007_devoir3
{
    public class Client
    {
        private string nom;
        private string prenom;
        private string adresse;
        private string ville;
        private string province;
        private string pays;
        private string noPermisConduire;
        private DateTime dateNaissance;
        private string noTelephone;
        private string courriel;
        private List<Location> locations;

        public Client()
        {
            locations = new List<Location>();
        }

        public Client(string nom, string prenom, string adresse, string ville, string province, string pays, string noPermisConduire, DateTime dateNaissance, string noTelephone, string courriel)
        {
            locations = new List<Location>();
            this.nom = nom;
            this.prenom = prenom;
            this.adresse = adresse;
            this.ville = ville;
            this.province = province;
            this.pays = pays;
            this.noPermisConduire = noPermisConduire;
            this.dateNaissance = dateNaissance;
            this.noTelephone = noTelephone;
            this.courriel = courriel;
        }

        public override string ToString()
        {
            return nom + ", " + prenom;
        }

        public string ToStringComplet()
        {
            return ToString() + "\r\n" +
                adresse + "\r\n" +
                ville + ", " + province + "\r\n" +
                pays + "\r\n" +
                dateNaissance.ToShortDateString() + "\r\n" + 
                getTelephoneFormatte() + "\r\n" +
                courriel;
        }

        public string getNoPermisConduire()
        {
            return noPermisConduire;
        }

        public string getTelephoneFormatte()
        {
            return "(" + noTelephone.Substring(0, 3) + ") " + noTelephone.Substring(3, 3) + "-" + noTelephone.Substring(6, 4);
        }

        public void ajouterLocation(Location location)
        {
            locations.Add(location);
        }

        public void supprimerLocation(Location location)
        {
            locations.Remove(location);
        }
    }
}
